package com.ysd.shopcar.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ysd.shopcar.entity.CarProdcut;
import com.ysd.shopcar.entity.Cart;
import com.ysd.shopcar.entity.ItemKill;
import com.ysd.shopcar.param.in.AddProductToCarRequestType;
import com.ysd.shopcar.param.in.ChangeProductNumRequestType;

public interface CartMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Cart record);

    int insertSelective(Cart record);

    Cart selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Cart record);

    int updateByPrimaryKey(Cart record);
    
    int addProductNum(ChangeProductNumRequestType request);
    
    int subProductNum(ChangeProductNumRequestType request);
    
    int delProduct(ChangeProductNumRequestType request);

    /**
     * 根据用户ID查询购物车商品信息
     * @param uid
     * @return
     */
	List<CarProdcut> queryCPListByUID(@Param("uid")Long uid);

	/**
	 * 将产品信息添加到购物车
	 * @param request
	 * @return
	 */
	int addProductToShopCar(AddProductToCarRequestType request);

	/**
	 * 根据用户ID删除购物车信息
	 * @param uid
	 * @return
	 */
	int delCarProduct(@Param("uid")String uid);

	ItemKill selectByPId(@Param("pid") String pid);

	int updateMSProdcut(@Param("pid") String pid);

	int existencePro(@Param("pid") String pid, @Param("uid") String uid);
    
}